<template>
	<view>
		<u-overlay :show="show" class="">
			<view class="body">
				<view class="content">
					<view class="title">{{title}}</view>
					<view class="line"></view>
					<scroll-view scroll-y style="max-height:60vh;">
						<view class="text-box">
							<view v-html="content"></view>
						</view>
					</scroll-view>
					<view class="btn-view" v-if="btnName">
						<view class="btn" @click="handleClick">
							{{btnName}}
						</view>
					</view>
					<view class="closeIcon" v-if="showCloseBtn" @click="show = false">
						<image src="/static/关闭.png" style="width: 60rpx;height: 60rpx;" mode=""></image>
					</view>
				</view>
			</view>
		</u-overlay>
	</view>
</template>

<script>
	export default {
		name: "popup_custom",
		props: {
			title: {
				type: String,
				default: ''
			},
			content: {
				type: String,
				default: ''
			},
			btnName: {
				type: String,
				default: ''
			},
			showCloseBtn: {
				type: Boolean,
				default: true
			}
		},
		data() {
			return {
				show: false,
			};
		},
		methods: {
			init() {
				this.show = true;
			},
			handleClick() {
				this.$emit("customClick");
				this.show = !this.show;
			},
		},
	}
</script>

<style scoped>
	page {}

	.body {
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.content {
		background-color: #fff;
		width: 75%;
		padding: 10rpx 30rpx;
		border-radius: 10rpx;
		position: relative;
	}

	.title {
		display: flex;
		align-items: center;
		justify-content: center;
		margin: 10rpx;
	}

	.line {
		border-bottom: 1px solid #C4C4D6;
		padding: 5rpx;
		margin: 0rpx 0rpx 10rpx 0rpx;
	}

	.text-box {
		padding: 10rpx 5rpx;
		line-height: 60rpx;
	}

	.btn-view {
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 10rpx;
		margin: 10rpx 0rpx;
	}

	.btn {
		background-color: #2979ff;
		color: #fff;
		padding: 20rpx 0rpx;
		width: 80%;
		text-align: center;
		border-radius: 10rpx;
	}

	.closeIcon {
		position: absolute;
		bottom: -90rpx;
		text-align: center;
		left: 0;
		right: 0;
		margin: auto;
	}
</style>